this.name        = "buzzer-wowbagger"; 
this.author      = "Darren Salt"; 
this.copyright   = "© 2009 Darren Salt"; 
this.description = "Occasionally adds Wowbagger."; 
this.version     = "1.0"; 

// missionVariables.buzzer_lastseen = 0;

this.shipExitedWitchspace = function ()
{
  // 1/64 chance of Wowbagger presence iff in-system, the player is at
  // least Competent, and Wowbagger hasn't been seen in the last 8 systems
  if (!system.isInterstellarSpace && player.score >= 64
      && (!missionVariables.buzzer_lastseen || !--missionVariables.buzzer_lastseen)
      && Math.random () < 1.0 / 64)
  {
    // Put Wowbagger somewhere between ¼ and ¾ of the way between the
    // witchpoint and the planet
    var pos = Math.random () / 2 + 0.25;
    system.legacy_addShipsAt ("buzzer-wowbagger", 1, "wpu",
			      [Math.random () / 32 - 1.0 / 64,
			       Math.random () / 32 - 1.0 / 64,
			       pos]);

    missionVariables.buzzer_lastseen = 8;
    this.insulted = 0;
  }
}
